/* AccountType.h
Michael Zahniser, 2008

Header file for the AccountType enumeration class, which represents
possible types of accounts in the Gringotts program.

All transactions are recorded as a transfer of money between two accounts,
which means that "accounts" include sources of income, categories of spending,
etc.
*/

#ifndef __GRINGOTTS_ACCOUNT_TYPE_H__
#define __GRINGOTTS_ACCOUNT_TYPE_H__

#include <string>

using std::string;



class AccountType {
public:
    // An "ACCOUNT" is the default account type. It represents money that is
    // saved in some account.
    static const AccountType ACCOUNT;
    // An "IN" account represents a source of income.
    static const AccountType IN;
    // An "OUT" account is a category of spending.
    static const AccountType OUT;
    // A "VIRTUAL" account is one that exists only to represent money that
    // appears "out of thin air" - for example, the initial funds that are
    // in an account before the transaction record begins, changes in value
    // of investments, etc.
    static const AccountType VIRTUAL;


public:
    AccountType();
    AccountType(const AccountType &accountType);
    AccountType(const string &name);

    AccountType &operator=(const AccountType &accountType);
    AccountType &operator=(const string &name);
    // Equality check.
    bool operator==(const AccountType &accountType) const;
    bool operator!=(const AccountType &accountType) const;

    // Get the name of this account type.
    const string &Name() const;

    // Return true if a negative balance is a _good_ thing (i.e. income).
    bool IsInverted() const;

    // Check whether accounts of this type can logically have their balances
    // displayed as a percentage of a total of accounts of the given type.
    bool IsCompatible(const AccountType &accountType) const;

    
private:
    AccountType(int type);


private:
    int type;


private:
    // Names of the different account types.
    static const string NAME[];
};



#endif
